{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'article/list' %}

{% set menu = 'admin_operation_article_manage' %}

{% block main %}
<form class="well well-sm form-inline" action="{{ path('admin_article') }}">

     {% include 'OrgBundle:Org:org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
     
	<div class="form-group">
		<select style="width:150px;" class="form-control" name="categoryId">
            <option value="0">--所属栏目--</option>
            {% for tree in categoryTree %}
                <option value={{ tree.id }} {% if tree.id == categoryId  %}selected{% endif%}>{% for i in 1..(tree.depth-1) if tree.depth > 1 %}　{% endfor %}{{ tree.name }}</option>
            {% endfor %}
		</select>
	</div>
	<div class="form-group">
		<input class="form-control" name="keywords" type="text" placeholder="标题关键词" value="{{ app.request.query.get('keywords') }}">
	</div>
	<div class="form-group">
		<select class="form-control" name="property">
		  {{ select_options(dict('articleProperty'), app.request.query.get('property'), '--属性--') }}
		</select>
	</div>
	<div class="form-group">
		<select class="form-control" name="status">
		  {{ select_options(dict('articleStatus'), app.request.query.get('status'), '--发布状态--') }}
		</select>
	</div>
	<button class="btn btn-primary" type="submit">搜索</button>
</form>

<div id="aticle-table-container">

<table class="table table-hover table-striped" id="article-table">
	<thead>
		<tr>
			<th><input type="checkbox"  data-role="batch-select" id="batch-select"> ID</th>
			<th width="25%">资讯标题</th>
			{% include 'OrgBundle:Org/Parts:table-thead-tr.html.twig' %}
			<th>栏目</th>
			<th>更新时间</th>
			<th>属性
                <a class="glyphicon glyphicon-question-sign text-muted pull-center " id="article-property-tips" data-toggle="tooltip" data-placement="bottom" href="javascript:" title="">
                </a>
	            <div id="article-property-tips-html" style="display:none;">
	                <p>设为“<strong>置顶</strong>”后，该资讯将会显示在列表的最前面。</p>
	                <p>设为“<strong>头条</strong>”后，如果设置了缩略图，则该资讯的缩略图将显示在资讯首页的头条图片区，图片尺寸建议统一为：754*424。</p>
	                <p>设为“<strong>推荐</strong>”后，该资讯将会显示在页面右侧的推荐资讯中。</p>
	            </div>
			</th>
			<th>状态</th>
			<th width="10%">操作</th>
		</tr>
	</thead>
	<tbody>
		{% if articles %}
			{% for article in articles %}
			  {% set category = categories[article.categoryId]|default(null) %}
			  {% include 'TopxiaAdminBundle:Article:article-tr.html.twig' %}
			{% endfor %}
		{% else %}
			<tr><td colspan="20"><div class="empty">暂无页面记录</div></td></tr>
		{% endif %}
	</tbody>
	</table>
  <div>
    <label class="checkbox-inline"><input type="checkbox" data-role="batch-select"> 全选</label>
    <button class="btn btn-default btn-sm mlm" data-role="batch-delete"  data-name="资讯" data-url="{{ path('admin_article_delete') }}">删除</button>
    {% include 'OrgBundle:Org:batch-update-org-btn.html.twig' with {module:'article', formId:'article-table', generate:"no-generate"} %}
  </div>
  </div>

{{ web_macro.paginator(paginator) }}

{% endblock %}